<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
  <title>用户分析</title>
  <link rel="stylesheet" href="./layui/css/layui.css">
  <link rel="stylesheet" type="text/css" href="css/base.css">
  <link rel="stylesheet" type="text/css" href="css/login.css">
</head>
<body>
<body>
	<div class="m-login-bg">
		<div class="m-login">
			<h3>后台系统登录</h3>
			<div class="m-login-warp">
				<form class="layui-form">
					<div class="layui-form-item">
						<input type="text" name="title" required lay-verify="required" placeholder="用户名" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-item">
						<input type="text" name="password" required lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<input type="text" name="verity" required lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-inline">
							<img class="verifyImg" onclick="this.src=this.src+'?c='+Math.random();" src="img/yzm.jpg" />
						</div>
					</div>
					<div class="layui-form-item m-login-btn">
						<div class="layui-inline">
							<button class="layui-btn layui-btn-normal" lay-submit lay-filter="login">登录</button>
						</div>
						<div class="layui-inline">
							<button type="reset" class="layui-btn layui-btn-primary">取消</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="./layui/layui.js"></script>
	<script>
		layui.use(['form'], function() {
			var form = layui.form;
			//自定义验证规则
			form.verify({
				title: function(value) {
					if(value.length < 5) {
						return '标题至少得5个字符啊';
					}
				},
				password: [/(.+){6,12}$/, '密码必须6到12位'],
				verity: [/(.+){6}$/, '验证码必须是6位'],
				
			});
			//监听提交
			form.on('submit(login)', function(data) {
				layer.alert(JSON.stringify(data.field), {
					title: '最终的提交信息',
					yes:function(){
						location.href="./index.html";
					}
				});
				return false;
			});
		});
	</script>
</body>
</html>